<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
How do I make things happen at compile time?
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot013.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot008.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot015.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc30">3.6</A>&nbsp;&nbsp;How do I make things happen at compile time?</H2>

A file being compiled may contain queries. These are goals
<A NAME="@default115"></A>
preceded by either the symbol &#8220;:-&#8221;.
As soon as a query is encountered in the compilation of a file,
the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> system will try to satisfy it.
Thus by inserting goals in this fashion, things can be made to happen at
compile time.<BR>
<BR>
In particular, a file can contain a directive to the system
to compile another file, and so large programs can be split between files,
while still only requiring a single simple command to compile them.
<A NAME="@default116"></A>
When this happens, ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> interprets the pathnames of the nested
compiled files relative to the directory of the parent compiled file;
if, for example, the user calls
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
[eclipse 1]: compile('src/pl/prog').
</PRE></BLOCKQUOTE>
and the file src/pl/prog.pl contains a query
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
:- [part1, part2].
</PRE></BLOCKQUOTE>
then the system searches for the files <TT>part1.pl</TT> and
<TT>part2.pl</TT>
in the
directory <TT>src/pl</TT> and not in the current directory.
Usually larger ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> programs have one main file which contains
only commands to compile all the subfiles.
In ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> it is possible to compile this main file from any directory.
(Note that if your program is large enough to warrant breaking into multiple
files (let alone multiple directories), it is probably worth turning the
constituent components into modules &mdash; see chapter <A HREF="umsroot037.html#chapmodules">7</A>.)<BR>
<BR>
<HR>
<A HREF="umsroot013.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot008.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot015.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
